package com.inoneone.toolkit.exception;

/**
 * ClassName:RegExp
 * Function: 常用正则表达式.
 * Reason:	 TODO ADD REASON.
 * Date:     2014年6月24日 上午10:24:29
 * @author   zhoudy
 * @version
 * @since    JDK 1.6
 * @see
 */
public class RegExp {
    public static final String MOBILE = "^(\\+86)?1[34578]\\d{9}$";
    public static final String BANK_CARD_NO = "^\\d{15,19}$";
    public static final String IDENTITY_NO = "^(^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$)|(^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])((\\d{4})|\\d{3}[Xx])$)$";
    //包含少数名族
    public static final String REAL_NAME = "^[\\u4e00-\\u9fa5·]{2,20}$";
    public static final String CREDIT_CVV = "^\\d{1,6}$";
    //MMyy
    public static final String CREDIT_EXPIRE = "^0[1-9]\\d{2}$|^1[012]\\d{2}$";
    public static final String SMS_VER_CODE = "^\\d{6}$";
    public static final String INPUT_CHARSET = "^GBK$|^UTF-8$";
    public static final String SIGN_TYPE = "^MD5$";
    public static final String BOOL = "^0|1$";
    public static final String AMOUNT_FEN = "^[1-9]\\d{0,11}$";
    public static final String AMOUNT_YUAN="^[1-9]\\d{0,9}(\\.(\\d){1,2})?$|^0\\.\\d[1-9]?$";
    public static final String AMOUNT_YUAN_ZERO="^[1-9]\\d{0,9}(\\.(\\d){1,2})?$|^0\\.\\d\\d?$";
    public static final String NUMBER = "^\\d+$";
    public static final String POSITIVE_NUMBER = "^[1-9]\\d*$";
    public static final String EMAIL = "^([a-zA-Z0-9]+[_|\\_|\\.|-]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\\_|\\.]?)*[a-zA-Z0-9]+\\.[a-zA-Z]{2,3}$";
    public static final String URL = "((http|ftp|https)://)(([a-zA-Z0-9\\._-]+\\.[a-zA-Z]{2,6})|([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}))(:[0-9]{1,4})*(/[a-zA-Z0-9\\&%_\\./-~-]*)?";
    public static final String YYYYMMDD = "^(19|20)[0-9][0-9]-(0?[1-9]|1[0-2])-(0?[1-9]|[12][0-9]|3[01])$";
    public static final String CARD_NO = "^[\\d]{6,10}$";
    public static final String TANKER_ID = "^[\\d]{6,10}$";
    public static final String VERIFY_SESSIONID = "^[0-9A-Za-z]{32}$";
    public static final String TIME = "^\\d\\d\\d\\d-\\d\\d-\\d\\d-\\d\\d-\\d\\d-\\d\\d$";
    public static final String ORDER_ID = "^\\d{1,20}$";
    public static final String SALT = "^.{6,}$";
    public static final String SECRET = "^.+$";
    public static final String YYYYMM = "^(19|20)[0-9][0-9]-(0?[1-9]|1[0-2])$";
    public static final String ZH = "[\\u4e00-\\u9fa5·]+";
    public static final String OPER_TYPE = "^1|2$";
    public static final String SERIAL_NO = "^\\d{13}";






    /**
     * 验证整数
     * @param a
     * @return
     */
    public static boolean matchNumber(String a) {
        if(a == null) {
            return false;
        }else {
            String expression = "^[0-9]|([1-9]\\d*)$";
            return a.matches(expression);
        }
    }
}

